import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'

// 引入normalize.css样式文件
import 'normalize.css/normalize.css'
// 引入公告的css配置文件
import '@/common/style.scss'
//引入el-icon图标组件
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import piniaPluginPersist from 'pinia-plugin-persistedstate' //导入持久化插件

//引入element-plus 样式文件
import 'element-plus/dist/index.css'
// 导入路由守卫
import '@/router/permission'

// element-plus国际化
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'

const app = createApp(App)

// element-plus国际化
app.use(ElementPlus, {
  locale: zhCn
})

// 注册el-icon图标组件
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

import 'amfe-flexible' // 引入amfe-flexible

import '@/common/js/rem.js'

const pinia = createPinia()
pinia.use(piniaPluginPersist)
app.use(pinia)
app.use(router)

app.mount('#app')
